<?php
/**
 * 后台登录接口
 * User: Administrator
 * Date: 2019/2/23 0023
 * Time: 22:32
 */

namespace app\index\interfaceIn;


use app\Lib\Exception\BlException;
use app\Lib\InterfaceIn\Api\Api;
use app\Lib\Ioc\User\AdminLogin;

class doLogin extends Common implements Api
{
    public function handle()
    {
        $this->check();
        $model = (new AdminLogin())->run($this->param->postData);
        return $this->returnCreate($model);
    }

    public function check()
    {
        $data = $this->param->postData;
        if(empty($data['account'])){
            throw new BlException('缺少登录账号');
        }
        if(empty($data['password'])){
            throw new BlException('缺少登录密码');
        }
        return true;
    }

}